package com.derbysoft.dswitch.adapter.ihg.web.action.admin.setting.rateplan;

import com.derbysoft.dswitch.adapter.ihg.common.domain.RatePlan;
import com.derbysoft.dswitch.adapter.ihg.common.repository.RatePlanRepository;
import com.derbysoft.dswitch.adapter.ihg.web.action.support.BaseAction;
import org.apache.struts2.convention.annotation.Action;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * Created by: jason
 * Date: 2012-06-05
 */
public class ListAction extends BaseAction {

    @Autowired
    private RatePlanRepository ratePlanRepository;

    private List<RatePlan> ratePlans;

    @Action("list")
    public String list() {
        ratePlans = ratePlanRepository.loadAll();
        return SUCCESS;
    }

    @Action("empty")
    public String empty() {
        return ADD;
    }

    public List<RatePlan> getRatePlans() {
        return ratePlans;
    }
}
